package com.ruoyi.omsampuser.mapper;

import java.util.HashMap;
import java.util.List;
import com.ruoyi.omsampuser.domain.OmSampuser;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 用户文章连接Mapper接口
 * 
 * @author ruoyi
 * @date 2025-02-24
 */
public interface OmSampuserMapper 
{
    /**
     * 查询用户文章连接
     * 
     * @param sampuserId 用户文章连接主键
     * @return 用户文章连接
     */
    public OmSampuser selectOmSampuserBySampuserId(Long sampuserId);

    /**
     * 查询用户文章连接列表
     * 
     * @param omSampuser 用户文章连接
     * @return 用户文章连接集合
     */
    public List<OmSampuser> selectOmSampuserList(OmSampuser omSampuser);

    /**
     * 新增用户文章连接
     * 
     * @param omSampuser 用户文章连接
     * @return 结果
     */
    public int insertOmSampuser(OmSampuser omSampuser);

    /**
     * 修改用户文章连接
     * 
     * @param omSampuser 用户文章连接
     * @return 结果
     */
    public int updateOmSampuser(OmSampuser omSampuser);

    /**
     * 删除用户文章连接
     * 
     * @param sampuserId 用户文章连接主键
     * @return 结果
     */
    public int deleteOmSampuserBySampuserId(Long sampuserId);

    /**
     * 批量删除用户文章连接
     * 
     * @param sampuserIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteOmSampuserBySampuserIds(Long[] sampuserIds);


    //@Param("id")int id,@Param("name")String name
    //https://www.cnblogs.com/mjn1/p/13168427.html
   @Select("SELECT sampuser_id AS sampuserId,sampuser_said as sampuserSaid ,sampuser_mpuid as sampuserMpuid,sampuser_openid AS sampuserOpenid ,sampuse_createtime AS sampuseCreatetime,sampuse_updatetime AS sampuseUpdatetime from om_sampuser where sampuser_said = #{said} and sampuser_openid = #{openid} ")
    OmSampuser getCheckInfo(@Param("said")Long said, @Param("openid")String openid);

    @Select("SELECT * from om_sampuser where sampuser_said = #{said} and sampuser_openid = #{openid} ")
    HashMap<String,Object> getCheckInfoMap(@Param("said")Long said, @Param("openid")String openid);

    @Delete("DELETE FROM om_sampuser WHERE sampuser_said = #{sampuserSaid} AND sampuser_openid = #{sampuserOpenid} ")
    int uncollect(OmSampuser omSampuser);
}
